//package cn.flying.cloud.esb.core.camel.process;
//
//import java.util.Map;
//
//import org.apache.camel.Exchange;
//import org.apache.camel.Processor;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.ApplicationContext;
//
//import cn.flying.cloud.base.common.utils.Ft;
//import cn.flying.cloud.esb.core.camel.constants.CamelConstant;
//import cn.flying.cloud.esb.core.enums.ErrorCodeEnum;
//import cn.flying.cloud.esb.core.exception.EsbException;
//import cn.flying.cloud.esb.entity.EbApplicationInfo;
//import cn.flying.cloud.esb.entity.EbAtomicParam;
//import cn.flying.cloud.esb.entity.EbAtomicService;
//import cn.flying.cloud.esb.model.ApiRequest;
//import cn.flying.cloud.esb.service.EbApplicationInfoService;
//import cn.flying.cloud.esb.service.EbAtomicParamService;
//import cn.flying.cloud.esb.service.EbAtomicServiceService;
//
///**
// * 数据转换理器
// *
// * @author: admin
// * @date: 2025年04月10日 17:12
// * @version: 1.0
// */
//public class ConvertDataProcessor implements Processor {
//    private final Logger logger = LoggerFactory.getLogger(this.getClass());
//
//    private ApplicationContext applicationContext;
//
//    public ConvertDataProcessor(ApplicationContext applicationContext) {
//        this.applicationContext = applicationContext;
//    }
//
//    /**
//     * Processes the message exchange
//     *
//     * @param exchange the message exchange
//     * @throws Exception if an internal processing error has occurred.
//     */
//    @Override
//    public void process(Exchange exchange) throws Exception {
//        ApiRequest request = exchange.getProperty(CamelConstant.API_REQUEST, ApiRequest.class);
//        Map map = (Map) request.getRequest().getBody();
//
//        EbAtomicServiceService atomicServiceService = applicationContext.getBean(EbAtomicServiceService.class);
//        EbAtomicService ebAtomicService = new EbAtomicService();
//        ebAtomicService.setServiceCode(request.getRequest().getHead().getServiceCode());
//        ebAtomicService.setStatus("Y");
//        ebAtomicService = atomicServiceService.getOneObj(ebAtomicService);
//
//        EbAtomicParamService atomicParamService = applicationContext.getBean(EbAtomicParamService.class);
//        EbAtomicParam ebAtomicParam = new EbAtomicParam();
//        ebAtomicParam.setServiceCode(request.getRequest().getHead().getServiceCode());
//        ebAtomicParam.setStatus("Y");
//        ebAtomicParam = atomicParamService.getOneObj(ebAtomicParam);
//
//        // 获取请求头
//        Map<String, Object> headers = exchange.getMessage().getHeaders();
//        // 获取请求体
//        byte[] bytes = (byte[]) exchange.getMessage().getBody();
//        String body = new String(bytes);
//        // 设置到新的请求中
//        exchange.getMessage().setHeaders(headers);
//        System.out.println("中间获取：" + body);
//        exchange.getMessage().setBody("345634574657457测试数据");
//    }
//}
